package org.hongqi.common.senpec.sys.menu;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Transient;
import lombok.*;
import org.hongqi.common.senpec.base.mybatisplus.IBaseEntity;

import java.util.Collection;

@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity(name = "senpec_sys_menu")
@TableName("senpec_sys_menu")
public class Menu extends IBaseEntity<Menu> {
    private Long parent = 0L;//0L代表没有父级菜单
    @Column(length = 10)
    private String type;//菜单对应的种类，包括button,item,submenu
    private Integer sequence;//顺序号，每个级别的菜单单独编号，同一子菜单的内容单独编号
    @Column(length = 20, unique = true)
    private String name;//路由对应的对应的name
    @Transient
    @TableField(exist = false)
    private String fullPath;//路由对应的对应的path
    @Transient
    @TableField(exist = false)
    private String redirect;
    @Column(length = 20, unique = true)
    private String title;
    @Column(length = 50)
    private String icon;
    private Boolean requiresAuth = true;//路径是否需要权限判断
    private Boolean isTail = false;//是否为兄弟中最后的元素
    @Transient
    @TableField(exist = false)
    private Collection<Menu> children;


}
